package cn.pku.eecs.ldn.activity;

import cn.pku.eecs.ldn.R;
import cn.pku.eecs.ldn.view.WobbleImageView;
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;

public class TestSensorActivity extends Activity{
	private static final String TAG = "TestSensorActiivty";

	WobbleImageView wobbleImageView = null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test_sensor);
		
		wobbleImageView = (WobbleImageView) findViewById(R.id.imageViewIcons);
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		if(wobbleImageView != null) {
			wobbleImageView.registerSensor();
		}
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		if(wobbleImageView != null) {
			wobbleImageView.unregisterSensor();
		}
	}

	private void test() {

	}

//	@Override
//	public void onAccuracyChanged(Sensor sensor, int accuracy) {
//		// TODO Auto-generated method stub
//		Log.d(TAG, "onAccuracyChanged");
//	}
//
//	@Override
//	public void onSensorChanged(SensorEvent event) {
//		// TODO Auto-generated method stub
//		synchronized (this) {
//			if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
//				Log.d(TAG, "onSensorChanged(): TYPE_ORIENTATION ");
//				Log.d(TAG, "onSensorChanged(): " + event.values[0] + " "
//						+ event.values[1] + " " + event.values[2]);
//			} else {
//				Log.d(TAG, "onSensorChanged(): other type ");
//			}
//		}
//	}

}
